'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH M_LABEL 3TSOL "Jul 20, 2007"
.SH NAME
m_label, m_label_alloc, m_label_dup, m_label_free \- m_label functions
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [\fIflag\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
.fi

.LP
.nf
#include <tsol/label.h>

\fBm_label_t *\fR\fBm_label_alloc\fR(\fBconst m_label_type_t\fR \fIlabel_type\fR);
.fi

.LP
.nf
\fBint\fR \fBm_label_dup\fR(\fBm_label_t **\fR\fIdst\fR, \fBconst m_label_t *\fR\fIsrc\fR);
.fi

.LP
.nf
\fBvoid\fR \fBm_label_free\fR(\fBm_label_t *\fR\fIlabel\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBm_label_alloc()\fR function allocates resources for a new label. The
\fIlabel_type\fR argument defines the type for a newly allocated label. The
label type can be:
.sp
.ne 2
.na
\fB\fBMAC_LABEL\fR\fR
.ad
.RS 14n
A Mandatory Access Control (MAC) label.
.RE

.sp
.ne 2
.na
\fB\fBUSER_CLEAR\fR\fR
.ad
.RS 14n
A user clearance.
.RE

.sp
.LP
The \fBm_label_dup()\fR function allocates resources for a new \fIdst\fR label.
The function returns a pointer to the allocated label, which is an exact copy
of the \fIsrc\fR label. The caller is responsible for freeing the allocated
resources by calling \fBm_label_free()\fR.
.sp
.LP
The \fBm_label_free()\fR function frees resources that are associated with the
previously allocated label.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, the \fBm_label_alloc()\fR function returns a
pointer to the newly allocated label. Otherwise, \fBm_label_alloc()\fR returns
\fINULL\fR and \fIerrno\fR is set to indicate the error.
.sp
.LP
Upon successful completion, the \fBm_label_dup()\fR function returns 0.
Otherwise, \fB-1\fR is returned and \fIerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBm_label_alloc()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
Invalid parameter.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
The physical limits of the system are exceeded by size bytes of memory which
cannot be allocated.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR libtsol (3LIB),
.BR label_to_str (3TSOL),
.BR str_to_label (3TSOL),
.BR label_encodings (5),
.BR attributes (7),
.BR labels (7)
.sp
.LP
\fIDetermining Whether the Printing Service Is Running in a Labeled
Environment\fR in \fISolaris Trusted Extensions Developer\&'s Guide\fR
.SH NOTES
.sp
.LP
The functionality described on this manual page is available only if the system
is configured with Trusted Extensions.
